# Common
if test $1 = 'common'
then
g++ -g -c common/Cond.cpp -o Cond.o -Icommon -Iengine
g++ -g -c common/Mutex.cpp -o Mutex.o -Icommon -Iengine
fi

# Engine
if test $2 = 'engine'
then
g++ -g -c engine/Formattable.cpp -o Formattable.o -Icommon -Iengine
g++ -g -c engine/Lockable.cpp -o Lockable.o -Icommon -Iengine
g++ -g -c engine/VarCol.cpp -o VarCol.o -Icommon -Iengine
g++ -g -c engine/TableState.cpp -o TableState.o -Icommon -Iengine
g++ -g -c engine/Table.cpp -o Table.o -Icommon -Iengine
fi

# Tests
if test $3 = 'read'
then
g++ -g -c tests/read.cpp -o read.o -Icommon -Iengine
g++ -g read.o Cond.o Formattable.o Lockable.o Mutex.o VarCol.o TableState.o Table.o -o read -lpthread
fi

if test $3 = 'write'
then
g++ -g -c tests/write.cpp -o write.o -Icommon -Iengine
g++ -g write.o Cond.o Formattable.o Lockable.o Mutex.o VarCol.o TableState.o Table.o -o write -lpthread
fi

if test $3 = 'insert'
then
g++ -g -c tests/insert.cpp -o insert.o -Icommon -Iengine
g++ -g insert.o Cond.o Formattable.o Lockable.o Mutex.o VarCol.o TableState.o Table.o -o insert -lpthread
fi

if test $3 = 'format'
then
g++ -g -c tests/format.cpp -o format.o -Icommon -Iengine
g++ -g format.o Cond.o Formattable.o Lockable.o Mutex.o VarCol.o TableState.o Table.o -o format -lpthread
fi
